/*
 * Copyright (c) 2018. cangoonline.net All Rights Reserved.
 * 类名称：MailSendController.java
 * 创建人：韩伟
 * 联系方式：hanwei@cangoonline.com
 */
package com.cango.qutz.web.controller;

import com.alibaba.fastjson.JSONObject;
import com.cango.framework.base.opt.DictUtils;
import com.cango.job.controller.JobBaseController;
import com.cango.job.vo.JobResult;
import com.cango.mail.MailSender;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Author: hanwei
 * CreateDate: 2019/9/17
 */
public class MailSendController extends JobBaseController {

    @Autowired
    private MailSender mailSender;

    @Autowired
    DictUtils dictUtils;

    @Override
    public JobResult service(String method, JSONObject param) {
        switch (method){
            case "sendMail":
                return sendMail(param);
            default:
                return new JobResult(RESPONSE_CODE_ERROR,"不存在的方法调用");
        }
    }


    private JobResult sendMail(JSONObject param){
        mailSender.sendMail();
        return new JobResult(RESPONSE_CODE_SUCCESS,"success");
    }

    @Override
    public String getKey() {
        return dictUtils.getDictEntity(900030001).getDictName();
    }

    @Override
    public String getAuthCode() {
        return dictUtils.getDictEntity(900030002).getDictName();
    }
}
